﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Bussiness.Entity;
using Bussiness.Manager;
using WB.Library;

public partial class Control_productCatelogy : System.Web.UI.UserControl
{

    public int CATEGOGYID
    {
        get
        {
            return (string.IsNullOrEmpty(Request["ID"]) == false ? Int32.Parse(Request["ID"]) : -1);
        }
    }

    public string GetTextID(string text)
    {
        return WB.Library.UnicodeConversion.CreateInstant().GetStringId(text);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        Page1.ChangePage += new EventHandler(Page1_ChangePage);
        if (!IsPostBack)
        {
          //  LoadCategory();
            LoadProduct(CATEGOGYID);
        }
    }

    void Page1_ChangePage(object sender, EventArgs e)
    {
        LoadProduct(CATEGOGYID);
    }

  


    private void LoadProduct(int CategoryID)
    {
        if (CategoryID != -1)
        {
            DataTable tab = CmsProductsManager.CreateInstant().GetProductByCategory(CategoryID, "vi-VN");
            if (tab != null && tab.Rows.Count > 0)
            {
                Page1.DataSource = tab.DefaultView;
                Page1.BindToControl = repProduct;
                repProduct.DataSource =  Page1.PagedDataSource;
                repProduct.DataBind();
            }
        }
    }
}


 
